﻿using System;
using System.Runtime.InteropServices;

namespace Ioacp.Irisking
{
    #region  识别Client委托（用来处理回调函数指针）

    /// <summary>
    /// 识别回调
    /// </summary>
    /// <param name="Param">TyPersonRecog结构指针</param>
    /// <returns></returns>
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void FuncRecogCallback(IntPtr pRecog);

    #endregion

    /// <summary>
    /// 对Ty.Client的原始封装
    /// </summary>
    public class TyClient
    {
        private const string IdenClientName = "Ty.Client.dll";

        /// <summary>
        /// 初始化IdenClient模块
        /// </summary>
        /// <param name="port">侦听端口</param>
        /// <param name="iden_client_func">回调处理函数指针</param>
        /// <returns></returns>
        [DllImport(IdenClientName, EntryPoint = "tyInit", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
        public static extern void tyInit(int port, FuncRecogCallback iden_client_func);

        /// <summary>
        /// 退出IdenClient模块
        /// </summary>
        /// <param name="FOnIden"></param>
        [DllImport(IdenClientName, EntryPoint = "tyTerminate", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
        public static extern void tyTerminate();
    }
}